/**
 * OSAmI: Open Source Ambient Intelligence
 * Copyright (C) 2010 Bull S.A.S.
 * Contact: osami-general@osami-commons.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 */

package org.osami.gateway.profile.heating;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

/**
 * A {@code HeatingProfile} is ...
 *
 * @author Guillaume Sauthier
 */
public class HeatingProfile {

    private static final double DEFAULT_TEMPERATURE = 21;
    private static final double DEFAULT_DELTA = 2;

    private final PropertyChangeSupport changes = new PropertyChangeSupport(this);

    /**
     * The "ideal" target temperature;
     */
    private double targetTemperature = DEFAULT_TEMPERATURE;

    /**
     * The accepted delta.
     */
    private double acceptedDelta = DEFAULT_DELTA;

    public double getTargetTemperature() {
        return targetTemperature;
    }

    public void setTargetTemperature(double targetTemperature) {
        double oldTemperature = this.targetTemperature;
        this.targetTemperature = targetTemperature;
        this.changes.firePropertyChange("targetTemperature", oldTemperature, targetTemperature);
    }

    public double getAcceptedDelta() {
        return acceptedDelta;
    }

    public void setAcceptedDelta(double acceptedDelta) {
        double old = this.acceptedDelta;
        this.acceptedDelta = acceptedDelta;
        this.changes.firePropertyChange("acceptedDelta", old, acceptedDelta);
    }

    public void addPropertyChangeListener(final PropertyChangeListener l) {
        this.changes.addPropertyChangeListener( l );
    }

    public void removePropertyChangeListener(final PropertyChangeListener l) {
        this.changes.removePropertyChangeListener( l );
    }

}
